package servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *
 * servlet
 * 测试 ServletConfig对象
 * 2018/5/9-21:52
 * 2018
 * Created by wuqiang on 2018/5/9.
 */
public class ServletConfigServlet extends HttpServlet {


    @Override
    public ServletConfig getServletConfig() {
        return super.getServletConfig();
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        System.out.println("获取所有初始化的名称");
        System.out.println(config.getInitParameterNames());
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        resp.getOutputStream().write("高小姐".getBytes());
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        doGet(req,resp);
    }
}
